﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace Medianamik.UI.Controls
{
    public class FloatTypeTextBox: SingleLineTextBox
	{
		#region Methods
			protected override void CreateControlHierarchy(bool pUseDataSource)
			{
			    var validator = new RegularExpressionValidator();
                Controls.Add(validator);

				if (!DataBound)
				{
                    validator.ValidationExpression = @"^[0-9]*\.?[0-9]*$";
                    validator.Display = ValidatorDisplay.Dynamic;
                    validator.ControlToValidate = ControlToValidateId;
                    validator.ErrorMessage = Label + " " + INVALID;
                    validator.EnableClientScript = EnableClientScriptValidation;
				}

				base.CreateControlHierarchy(pUseDataSource);				
			}			
		#endregion
	}
}